<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <!-- MOTW-DISABLED saved from url=(0014)about:internet -->
    <title>Sort the data</title>
    <link rel="StyleSheet" href="css/getstarted.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="css/webworks.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="webworks.css" type="text/css" media="all" />
    <script type="text/javascript" language="JavaScript1.2">
      <!--
        var  WebWorksRootPath = "";
      // -->
    </script>
  </head>
  <body>
    <div style="text-align: left;">
      <table cellspacing="0" summary="">
        <tr>
          <td>
            <a href="gs-TutT5LayOutTheReport.html"><img src="images/prev.gif" alt="Previous" border="0" /></a>
          </td>
          <td>
            <a href="gs-IncreaseTheSpaceBetweenRows.html"><img src="images/next.gif" alt="Next" border="0" /></a>
          </td>
        </tr>
      </table>
    </div>
    <hr align="left" />
    <blockquote>
      <h3 class="N_TutorialTask">Task 6:&nbsp;&nbsp;<a name="184405">Sort the data</a></h3>
      <p class="b_Body"><a name="245124">When you first create and preview a report, the report displays the data rows in the order in which the query returns them. The order can vary, depending on many factors, such as how data was supplied in the data source. In most cases, you will want to change the order in which data appears in the report.</a></p>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">1&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138834">Choose Layout to return to the layout editor.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">2&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138835">Open Property Editor, if necessary. If you use the default report design perspective, Property Editor appears below the layout editor. If it is not open, choose Window</a><span class="Dingbat">&rarr;</span>Show View<span class="Dingbat">&rarr;</span>Property Editor.</div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">3&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138842">In the layout editor, select the table by selecting the Table tab in the lower left corner, as shown in </a><a href="#325461" title="Sort the data">Figure&nbsp;1-18</a>. This tab appears when you hover the mouse pointer over the lower left corner of the table. </div>
            </td>
          </tr>
        </table>
      </div>
      <p class="i2_Image2"><a name="325442"><img class="Default" src="images/layout_tabletab.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-18 Selecting the table" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;1-18&nbsp;&nbsp;</b><a name="325461">Selecting the table</a></div>
      <div class="N_i_Indent1"><a name="325428">Property Editor displays the properties for the table, as shown in </a><a href="#511924" title="Sort the data">Figure&nbsp;1-19</a>.</div>
      <p class="i2_Image2"><a name="511922"><img class="Default" src="images/prop_editor_table.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-19 Property Editor displaying the general properties of the table" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;1-19&nbsp;&nbsp;</b><a name="511924">Property Editor displaying the general properties of the table</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">4&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="425183">Choose the Sorting tab, then choose Add to specify a sort key.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">5&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="344757">In New Sort Key, specify the following values:</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="b2_Bullet2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="b2_Bullet2_inner" style="width: 14.1732pt; white-space: nowrap">
                <img src="Bullet.png" alt="*" border="0" width="6" height="6" />
              </div>
            </td>
            <td width="100%">
              <div class="b2_Bullet2_inner"><a name="255817">In Key, select CUSTOMERNAME from the drop-down list.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="b2_Bullet2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="b2_Bullet2_inner" style="width: 14.1732pt; white-space: nowrap">
                <img src="Bullet.png" alt="*" border="0" width="6" height="6" />
              </div>
            </td>
            <td width="100%">
              <div class="b2_Bullet2_inner"><a name="255821">Use the default values for the other fields.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_i_Indent1"><a href="#255848" title="Sort the data" name="255822">Figure&nbsp;1-20</a> shows the sort definition.</div>
      <p class="i2_Image2"><a name="255826"><img class="Default" src="images/NewSortKey_qs.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-20 Sort definition in New Sort Key" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;1-20&nbsp;&nbsp;</b><a name="255848">Sort definition in New Sort Key</a></div>
      <div class="N_i_Indent1"><a name="264673">Choose OK. The Sort page displays the defined sort key.</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">6&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="147770">Preview the report. The sorted data appears in ascending order by customer name, as shown in </a><a href="#191407" title="Sort the data">Figure&nbsp;1-21</a>. </div>
            </td>
          </tr>
        </table>
      </div>
      <p class="i2_Image2"><a name="147813"><img class="Default" src="images/output_sorted_1.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-21 Data sorted by customer name" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;1-21&nbsp;&nbsp;</b><a name="191407">Data sorted by customer name</a></div>
      <div class="N_i_Indent1"><a name="147817">Notice that names with uppercase letters appear at the top of the list. BIRT sorts string data by UCS-2 code point values. In ASCII-based character sets, uppercase letters have lower code point values than lowercase letters. Therefore, uppercase letters appear before lowercase letters.</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">7&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="319425">Sort the customer names case-insensitively so that ANG Resellers appears after American Souvenirs Inc., rather than before.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">1&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="319432">Choose Layout to return to the layout editor.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">2&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="319437">In the Sort page, shown in </a><a href="#366556" title="Sort the data">Figure&nbsp;1-22</a>, select the sort key, then choose Edit.</div>
            </td>
          </tr>
        </table>
      </div>
      <p class="i3_Image3"><a name="255893"><img class="Default" src="images/sortpage.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-22 Sort key displayed on the Sort page" /></a></p>
      <div class="fc3_FigCall3Title">
        <b class="Bold">Figure&nbsp;1-22&nbsp;&nbsp;</b><a name="366556">Sort key displayed on the Sort page</a></div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">3&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="366559">In Edit Sort Key, change the Sort Key expression to the following expression, then choose OK:</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="cfi2_CodeFirstIndent2"><a name="147795">row["CUSTOMERNAME"].toUpperCase()</a></div>
      <div class="N_i2_Indent2"><a name="344857">This expression uses the JavaScript toUpperCase(&nbsp;) function to convert all the customer name values to uppercase before sorting. JavaScript </a>function names are case-sensitive, so you must type toUpperCase(&nbsp;) exactly as shown. References to column names are also case-sensitive. In this expression, row["CUSTOMERNAME"] is the correct name to use. If you type row["customername"], for example, BIRT Report Designer displays an error when you run the report. You can verify the capitalization of a column name by looking at the name that is displayed in Data Explorer.</div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">8&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="344902">Preview the report. </a></div>
            </td>
          </tr>
        </table>
      </div>
    </blockquote>
    <hr align="left" />
    <table align="right" summary="">
      <tr>
        <td class="WebWorks_Company_Name_Bottom">
          <a href="notices.html">(c) Copyright Actuate Corporation 2013</a>
        </td>
      </tr>
    </table>
  </body>
</html>